home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Format 1995 June
/
MacFormat 25.iso
/
Shareware City
/
Developers
/
fortran-to-c-translator-11
/
Mac F2C 1.1
/
Mac F2C Libraries
/
libI77 Sources
/
fmtlib.c
< prev
next >
Wrap
Text File
|
1995-01-28
|
582b
|
29 lines
/* @(#)fmtlib.c 1.2 */
#define MAXINTLENGTH 23
#ifdef KR_headers
char *f__icvt(value,ndigit,sign, base) long value; int *ndigit,*sign;
register int base;
#else
char *f__icvt(long value, int *ndigit, int *sign, int base)
#endif
{ static char buf[MAXINTLENGTH+1];
register int i;
if(value>0) *sign=0;
else if(value<0)
{ value = -value;
*sign= 1;
}
else
{ *sign=0;
*ndigit=1;
buf[MAXINTLENGTH]='0';
return(&buf[MAXINTLENGTH]);
}
for(i=MAXINTLENGTH-1;value>0;i--)
{ *(buf+i)=(int)(value%base)+'0';
value /= base;
}
*ndigit=MAXINTLENGTH-1-i;
return(&buf[i+1]);
}